<?php


class Model_Acl extends Zend_Acl {

    public function __construct () {

	$this->add(new Zend_Acl_Resource('default'));
	$this->add(new Zend_Acl_Resource('default:index'), 'default');
	$this->add(new Zend_Acl_Resource('default:error'), 'default');

//	seller resource
	$this->add(new Zend_Acl_Resource('seller'));
	$this->add(new Zend_Acl_Resource('seller:index'), 'seller');
	$this->add(new Zend_Acl_Resource('seller:product'), 'seller');
	$this->add(new Zend_Acl_Resource('seller:dashboard'), 'seller');
	$this->add(new Zend_Acl_Resource('seller:error'), 'seller');
	$this->add(new Zend_Acl_Resource('seller:test'), 'seller');

//	$this->add(new Zend_Acl_Resource('seller:xhr_product'), 'seller');


//	seller resource
	$this->add(new Zend_Acl_Resource('buyer'));
	$this->add(new Zend_Acl_Resource('buyer:index'), 'buyer');
	$this->add(new Zend_Acl_Resource('buyer:product'), 'buyer');
//	$this->add(new Zend_Acl_Resource('buyer:dashboard'), 'seller');
	$this->add(new Zend_Acl_Resource('buyer:error'), 'buyer');
	$this->add(new Zend_Acl_Resource('buyer:settings'), 'buyer');



	$this->addRole(new Zend_Acl_Role('guest'));
	$this->addRole(new Zend_Acl_Role('buyer'), 'guest');
	$this->addRole(new Zend_Acl_Role('seller'), 'guest');
	$this->addRole(new Zend_Acl_Role('admin'), 'seller');


	//guest's previllage
	$this->allow('guest', 'default:index', array('index'));
	$this->allow('guest', 'seller:index', array('index', 'register'));
	$this->allow('guest', 'seller:test', array('index'));



	$this->allow('guest', 'buyer:index', array('index', 'search')); //index controller
	$this->allow('guest', 'buyer:product', array('index','buy', 'single', 'new', 'success', 'payment', 'nearby', 'category'));
	$this->allow('guest', 'buyer:settings', array('index'));


//	seller's previllage
//	$this->allow('seller', 'seller');
	$this->allow('seller', 'seller:index', array('index','logout')); //index controller
	$this->allow('seller', 'seller:product', array('index','delete', 'edit', 'new', 'test', 'ajax', 'week','month'));
	$this->allow('seller', 'seller:dashboard', array('index'));
	$this->allow('seller', 'seller:error', array('index'));
//	$this->allow('seller', 'seller:xhr_product', array('ajax'));


//	buyers's previllage
	$this->allow('buyer', 'buyer:index', array('index')); //index controller
	$this->allow('buyer', 'buyer:product', array('index','buy', 'single', 'new'));
	$this->allow('buyer', 'buyer:settings', array('index'));
	//$this->allow('buyer', 'buyer:dashboard', array('index'));


    }
}


